name="abcdefg"
#print(name[2])

#不包括结束下标

print(name[2:5:1])
print(name[2:5])
print(name[:5])
print(name[1:])
print(name[:])
print(name[::2])

print(name[:-1])    #-1是倒数最后一个
print(name[-4:-1])

print(name[::-1])     #字符串逆序